//-----------------------------------------------------------------------
// <copyright file="CompanyAndBusinesService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class CompanyAndBusinesService
    {
        #region CompanyAndBusines

        public static void CreateCompanyAndBusines(CompanyAndBusines companyAndBusines)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                companyAndBusinesDAO.CreateCompanyAndBusines(companyAndBusines);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateCompanyAndBusinesException, ex);
            }
        }        

        public static void UpdateCompanyAndBusines(CompanyAndBusines companyAndBusines)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                companyAndBusinesDAO.UpdateCompanyAndBusines(companyAndBusines);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateCompanyAndBusinesException, ex);
            }
        }        

        public static void DeleteCompanyAndBusines(int companyAndBusinessID)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                companyAndBusinesDAO.DeleteCompanyAndBusines(companyAndBusinessID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteCompanyAndBusinesException, ex);
            }
        }
        
        public static CompanyAndBusines GetCompanyAndBusines(int companyAndBusinessID)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                return companyAndBusinesDAO.GetCompanyAndBusines(companyAndBusinessID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndBusinesException, ex);
            }
        }                

        public static CompanyAndBusinesCollection GetCompanyAndBusinesList(CompanyAndBusinesColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                return companyAndBusinesDAO.GetCompanyAndBusinesList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndBusinesListException, ex);
            }
        }        

        public static CompanyAndBusinesCollection GetCompanyAndBusinesList(CompanyAndBusinesColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                return companyAndBusinesDAO.GetCompanyAndBusinesList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndBusinesListException, ex);
            }
        }        

	    public static CompanyAndBusinesCollection GetCompanyAndBusinesListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                return companyAndBusinesDAO.GetCompanyAndBusinesListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndBusinesListException, ex);
            }
        }        

        public static CompanyAndBusinesCollection GetCompanyAndBusinesListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                CompanyAndBusinesDAO companyAndBusinesDAO = new CompanyAndBusinesDAO();
                return companyAndBusinesDAO.GetCompanyAndBusinesListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndBusinesListException, ex);
            }
        }        

        #endregion
    }
}